import yaml
from config.tools import get_project_path,sep

class GetConf:
    def __init__(self):
        project_dir = get_project_path()
        with open(project_dir+sep(['config','environment.yaml'],add_sep_before=True), 'r') as env_file:
            self.env = yaml.load(env_file,Loader=yaml.FullLoader)

    def get_username_password(self):
        # 默认返回多个值都是以元组形式返回的，除非定义成字典
        return self.env['username'], self.env['password']

    def get_url(self):
        return self.env['url']

if __name__ == '__main__':
    print(GetConf().get_url())